package cn.com.open.itembank.logic.questiontype;

import cn.com.open.itembank.dto.QuestionImportModel;

import java.math.BigDecimal;

/**
 * Created by lucky on 2017/12/19.
 */
public class ReadingComprehensionItem extends BaseSubItem {
    /**
     * Instantiates a new Reading comprehension item.
     *
     * @param model the model
     */
    public ReadingComprehensionItem(QuestionImportModel model) {
        super(model);
    }

    //region 校验分数

    /**
     * 校验分数.
     *
     * @return the boolean
     */
    @Override
    public boolean checkScoreFormat() {
        boolean result = true;

        if ((new BigDecimal(importModel.getScore())).compareTo(new BigDecimal(importModel.getSubItems().size())) < 0) //分数要大于等于子试题数
        {
            result = false;
            importModel.setErrorInfo("子试题分数不匹配；");
        }

        return result;
    }
    //endregion
}
